import {SET_NUMBER, CHANGE_METHOD} from "../actions/calculator";
import calculator from "../reducers/calculator";

export default (ctx) => {
    const {setNumber, changeMethod} = calculator(ctx.$data);

    return function (type, ...arg) {
        switch (type) {
            case SET_NUMBER:
                ctx.result = setNumber(...arg);
                break;
            case CHANGE_METHOD:
                ctx.result = changeMethod(...arg);
                break;
            default:
                break;
        }
    }
}
